﻿using System.Windows;
using System.Windows.Controls;

namespace PSE.Deployment.ConfigurationManager.Controls
{
	public class ScreenTitle : Control
	{
		Button _PART_SaveButton;
		Label _PART_Header;
		RoutedEventHandler _buttonClickEvent;

		public Button SaveButton
		{
			get { return _PART_SaveButton; }
			set { _PART_SaveButton = value; }
		}
		public object Header
		{
			get { return _PART_Header.Content; }
			set { _PART_Header.Content = value; }
		}
		public RoutedEventHandler ButtonClickEvent
		{
			get { return _buttonClickEvent; }
			set { _buttonClickEvent = value; }
		}

		public override void OnApplyTemplate()
		{
			base.OnApplyTemplate();

			_PART_SaveButton = base.GetTemplateChild("PART_SaveButton") as Button;
			_PART_Header = base.GetTemplateChild("PART_Header") as Label;

			if (_buttonClickEvent != null && _PART_SaveButton != null)
				_PART_SaveButton.Click += _buttonClickEvent;

			_PART_Header.Content = "Selecione a opção desejada";
		}
	}
}